type Char native  // rune (int32)

type String native  // string

type ToString interface { String String }


// Char

public function
    Char? { codepoint Int } Maybe[Char]
    native('__CharFromInt')

public method
    Char.String String
    native('__StringFromChar')

public operator == { a Char, b Char } Bool native('__CharEqual')


// String

function
    StringConcat { strings List[String] } String
    native('__StringConcat')

public function variadic
    String { items List[ToString] } String
    { StringConcat((items.Seq map { (item) => item.String }).List) }

public function variadic
    StringFromChars { chars List[Char] } String
    native('__StringFromListOfChar')

public method
    String.String String
    { this }

public method
    String.Utf8Length Int
    native('__StringUtf8Length')

public method
    String.Empty Bool
    { (this == '') }

public method
    String.Seq Seq[Char]
    native('__StringToSeq')

public method
    String.List List[Char]
    { this.Seq.List }

public operator == { a String, b String } Bool     native('__StringEqual')
public operator  < { a String, b String } Bool     native('__StringLessThan')
public operator <> { a String, b String } Ordering native('__StringCompare')

public function
    Quote { raw String } String
    native('__Quote')

public function
    Unquote { quoted String } Maybe[String]
    native('__Unquote')

public operator
    ?? { s String, fallback String } String
    { if (s.Empty) { fallback } else { s } }

public operator
    contains { s String, target String } Bool
    native('__StringContains')

public operator
    split { s String, sep String } Seq[String]
    native('__StringSplit')

public operator
    join { all Seq[String], sep String } String
    native('__StringJoin')

public operator
    join { all List[String], sep String } String
    { (all.Seq join sep) }

public operator
    trim { s String, c Char } String
    native('__StringTrim')

public operator
    trim-left { s String, c Char } String
    native('__StringTrimLeft')

public operator
    trim-right { s String, c Char } String
    native('__StringTrimRight')

public operator
    trim-prefix { s String, prefix String } String
    native('__StringTrimPrefix')

public operator
    trim-suffix { s String, suffix String } String
    native('__StringTrimSuffix')

public operator
    has-prefix { s String, prefix String } Bool
    native('__StringHasPrefix')

public operator
    has-suffix { s String, suffix String } Bool
    native('__StringHasSuffix')


